<!DOCTYPE html>
<html>
<head lang="en">
    <title>字符串拼接测试</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <link rel="stylesheet" type="text/css" href="./stylesheets/base.css">
    
</head>
<body>
<script>
var str="s";
console.time("普通拼接");
for(var i=0;i<10000000;i++){
    str+="2KD";
}
console.timeEnd("普通拼接");


console.time("使用数组拼接");
var str1="d",arr=[];
arr.push(str1);
for(var i=0;i<10000000;i++){
    arr.push("2KD");
}
arr.join("");
console.timeEnd("使用数组拼接");
</script>
</body>
</html>
